public class test01 {
    public List<List<String>> groupAnagrams(String[] strs) {
        Map<String,List<String>> hashmap = new HashMap<>();
        for(String str:strs){
            char[] ch = str.toCharArray();
            Arrays.sort(ch);
            String key = new String(ch);
            List<String> list = hashmap.getOrDefault(key,new ArrayList<>());
            list.add(str);
            hashmap.put(key,list);
        }
        return new ArrayList<List<String>>(hashmap.values());
    }
}
